import request from '@/utils/request';
// 查询机构
function getOrganize(params) {
  return request({
    url: '/department/select',
    method: 'GET',
    params
  });
};
// 新增机构
function addOrganize(data) {
  return request({
    url: '/department/add',
    method: 'POST',
    data
  });
}
// 根据部门id查询该部门所有人员
function getSelectUserByDepartmentId(params) {
  return request({
    url: '/department/selectUserByDepartmentId',
    method: 'get',
    params
  });
}
// 删除机构
function deleteOrganize(params) {
  return request({
    url: '/department/delete',
    method: 'get',
    params
  });
}
// 编辑机构
function editOrganize(data) {
  // console.log('传过来的数据', data);
  return request({
    url: '/department/update',
    method: 'POST',
    data
  });
}

// 获取所有老师
export function getSelectTeacher() {
  return request({
    url: '/department/selectTeacher',
    method: 'get'
  });
}

// 获取所有组织机构
export function getSselectAllDepart() {
  return request({
    url: '/department/selectAllDepart',
    method: 'get'
  });
}

// 获取所有学生
export function getSelectStudent() {
  return request({
    url: '/department/selectStudent',
    method: 'get'
  });
}

// 批量修改部门人员
export function updateDepartmentUser(data) {
  return request({
    url: '/department/updateDepartmentUser',
    method: 'post',
    data
  });
}

// 获取人员列表
function getDepartmentUser(departmentId, userName) {
  return request({
    url: '/department/selectDepartmentUser',
    method: 'POST',
    params: { departmentId, userName }
  });
}
// 上移下移
function moveProjectMyTask(departmentId, order, parentId, type) {
  console.log('传过来的数据', departmentId, order, parentId, type);
  return request({
    url: '/department/updateProjectMyTask',
    method: 'GET',
    params: { departmentId, order, parentId, type }
  });
}
export { getOrganize, addOrganize, deleteOrganize, editOrganize, getDepartmentUser, moveProjectMyTask, getSelectUserByDepartmentId };
